﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace HenIT.IO
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                MessageBox.Show("This application must be executed with 2 parameters\r\n1. Full source file path\r\n2. Full destination file path\r\n3. Optionally - Move (/m)",
                    "Command line parameters required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                AsyncFileAction afa = new AsyncFileAction();               

                FileCopyProgress m = new FileCopyProgress();
                string sourceFile = args[0];
                string destinationFile = args[1];
                bool move = false;
                if (args.Length > 2)
                    if (args[2] == "-m" || args[2] == "/m")
                        move = true;
                if (move)
                    afa.MoveFile(sourceFile, destinationFile);
                else
                    afa.CopyFile(sourceFile, destinationFile);
            }
        }
    }
}
